<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>个人中心</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.11.3.min.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">在线考试系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

            <li class="layui-nav-item layui-hide-xs"><a href="">刷新</a></li>

        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
                    student
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="information_page.html">个人中心</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a href="/index.html">退出
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">考试系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" data-id="1" data-title="个人中心">个人中心</a></dd>
                        <dd><a href="select_page.html" data-id="1" data-title="试卷选择">试卷选择</a></dd>
                    </dl>
                </li>
            </ul>

        </div>
    </div>
    <div class="layui-body">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">个人中心</li>
            </ul>
            <table style="margin: 0 auto;background: white;font-size: 20px;border-spacing:20px;border-collapse:separate;" >
                <tr>
                    <td>学号</td>
                    <td>
                        <input type="text" id="stuID"disabled>
                    </td>
                </tr>
                <tr >
                    <td>姓名</td>
                    <td>
                        <input type="text" id="stuName" >
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td>手机号码</td>
                    <td>
                        <input type="text" id="tel" >
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td style="float: right">
                        <button onclick="inform_update()">提交</button>
                    </td>
                </tr>
            </table>

        </div>
    </div>
    <div class="layui-footer" style="text-align: center">
        <!-- 底部固定区域 -->
        ©版权 西北农林科技大学
    </div>
</div>
<script type="text/html" id="bar2" lay-filter="test">已读
</script>
<script>
    //JS
    var inform;
    $.post("/student/selectOne",
        {
        },
        function(data){
            inform=data;
            console.log(data);
            document.getElementById("stuID").value=data.stuid;
            document.getElementById("stuName").value=data.stuname;
            document.getElementById("tel").value=data.tel;
        });

    function inform_update() {
        inform.stuid=document.getElementById("stuID").value;
        inform.stuname=document.getElementById("stuName").value;
        inform.tel=document.getElementById("tel").value;
        console.log(inform.stuid+"inform");
        $.post("/student/update",
            {
                stuid: inform.stuid,
                stuname: inform.stuname,
                tel: inform.tel,
            },
            function(data){
                console.log(data+"data");
                console.log(inform+"inform");
            });
        window.alert("修改成功!");
        // console.log("##"+inform.stuname+"##");
        window.location.href= 'information_page.html';
    }

    layui.use(['element', 'layer', 'util','table'], function(){
        var element = layui.element
            ,layer = layui.layer
            ,util = layui.util
            ,$ = layui.$
            ,table = layui.table;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function(othis){
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
        });
    });

</script>
</body>
</html>